package com.taptech.doufu.ui.view.drawcircle;

import android.content.Context;
import android.os.Handler;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.taptech.doufu.R;
import com.taptech.doufu.bean.MineAbstractBean;

/**
 * Created by lsy on 2015/8/6.
 */

public abstract class BaseRecyclerViewViewHolder<T extends MineAbstractBean> extends RecyclerView.ViewHolder
{

    static public final int SPECIAL_TYPE_COLLECT = 1;   // 收藏的删除按钮会变成取消收藏
    static public final int TWO_SPAN_DISPLAY = 2;       // 双瀑布流的ui细节有变化
    static public final int SPECIAL_TYPE_PERSONAL_DELETE = 4;   // 个人中心删除

    protected Context mContext;

    protected Handler mHandler;
    //内容来源
    public TextView mCircleSource;
    // 排名标志
    public ImageView rankImageView;
    protected int mPosition;
    private int deleteType;


    public BaseRecyclerViewViewHolder(Context context, View itemView)
    {
        super(itemView);
        mContext = context;
    }

    public void setHandler(Handler handler)
    {
        this.mHandler = handler;
    }

    public void setDeleteType(int deleteType)
    {
        this.deleteType = deleteType;
    }

    public abstract void setViewHolderChildViewContent(T bean, int position);

    protected void setRankImageView(int rankPos)
    {
        if (rankImageView != null && mCircleSource != null)
        {
            rankImageView.setVisibility(View.VISIBLE);
            mCircleSource.setVisibility(View.GONE);
            switch (rankPos)
            {
                case 1:
                    rankImageView.setImageResource(R.drawable.home_rank_img1);
                    break;
                case 2:
                    rankImageView.setImageResource(R.drawable.home_rank_img2);
                    break;
                case 3:
                    rankImageView.setImageResource(R.drawable.home_rank_img3);
                    break;
                default:
                    mCircleSource.setVisibility(View.VISIBLE);
                    rankImageView.setVisibility(View.GONE);
                    break;
            }
        }
    }

}
